import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '@/views/Home.vue';
import Welcome from '@/views/Home/Welcome.vue';
import Technology from '@/views/Home/Technology.vue';
import Equipment from '@/views/Home/Equipment.vue';
import Quality from '@/views/Home/Quality.vue';
import Knowledge from '@/views/Home/Knowledge.vue';
import Login from '@/views/Login.vue';
import Admin from '@/views/Admin.vue';
import Users from '@/views/User/Users.vue';
import AddUsers from '@/views/User/AddUsers.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login,
  },
  {
    path: '/admin',
    name: 'Admin',
    component: Admin,
    redirect: '/admin/add_users',
    children: [
      {
        path: 'users',
        component: Users,
      },
      {
        path: 'add_users',
        component: AddUsers,
      },
    ],
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/home/welcome',
    children: [
      {
        path: 'welcome',
        name: Welcome,
        component: Welcome,
      },
      {
        path: 'technology',
        component: Technology,
      },
      {
        path: 'equipment',
        component: Equipment,
      },
      {
        path: 'quality',
        component: Quality,
      },
      {
        path: 'knowledge',
        component: Knowledge,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;

// router.$addRoutes = (params) => {
//   router.matcher = new VueRouter({ mode: 'history' }).matcher;
//   router.addRoutes(params);
// };
